package com.moon.icoresso.init;

import com.alibaba.fastjson.JSONObject;
import com.moon.icoresso.Service.OauthRedisService;
import com.moon.icoresso.common.utils.StringRedisService;
import com.moon.icoresso.pojo.bo.OauthToRedisBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

/**
 * @ClassName OauthDataInit
 * @Description
 * @Author menbbo
 * @Date 2021/2/14 18:42
 * @Version V1.0
 **/
@Component
@Profile({"dev"})
public class OauthDataInit  implements ApplicationRunner {

    @Autowired
    private StringRedisService stringRedisService;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        OauthToRedisBO oauthToRedisBO = new OauthToRedisBO();
        oauthToRedisBO.setClientId("client_test_2");
        oauthToRedisBO.setClientSecret("admin");
        oauthToRedisBO.setRedirectUri("www.baidu.com");
        stringRedisService.set("OAUTH:CLIENT_ID:client_test_2", JSONObject.toJSONString(oauthToRedisBO),200000);
    }
}